package com.nengchuan.kbms.dfs.config;

import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author luo_zm
 * @DESCRIPTION
 * @create 2020/4/15 11:18
 */
@Configuration
public class FeignSupportConfig {

    @Autowired
    private ObjectFactory<HttpMessageConverters> messageConverters;

    /**
     *    * @Description // 此处注入的是： ObjectFactory<HttpMessageConverters>
     *    * @Date 23:04 2020/4/9
     *    * @Param []
     *    * @return feign.form.spring.SpringFormEncoder
     *    
     **/
    @Bean
    public Encoder feignEncoder() {
        return new SpringFormEncoder(new SpringEncoder(messageConverters));
    }
}